package com.kyivmohyla.kma2.dao.mapper;

import com.kyivmohyla.kma2.model.State;
import org.springframework.jdbc.core.ResultSetExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;

class StateResultSetExtractor implements ResultSetExtractor<State> {

    @Override
    public State extractData(ResultSet resultSet) throws SQLException {
        State state = new State();
        try {
            state.setStateId(resultSet.getInt("state_id"));
            state.setName(resultSet.getString("name"));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return state;
    }

}